package com.hailiang.study.javase.java.util.concurrent.future;

import java.util.Random;
import java.util.concurrent.Callable;

/**
 * @author hailiang.jiang
 * @date 2021年07月30 17:21
 */
public class EmailTask implements Callable<String> {

    private String userName;

    // customerId是假设每个任务都需要设置执行的参数。
    public EmailTask(String userName) {
        this.userName = userName;
    }

    @Override
    public String call() throws Exception {
        Thread.sleep(new Random().nextInt(1000) + 1);
        System.out.println("email task userName = " + this.userName);
        return userName;
    }
}
